import 'package:bxultimate/app/router/router_name.dart';
import 'package:bxultimate/data/request/shop_request.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'state.dart';

class ShopIndexController extends GetxController
    with GetSingleTickerProviderStateMixin {
  final ShopIndexState state = ShopIndexState();


  TabController? tabController;

  var tabItem = ['周边', '精选'];

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();

    getData();
    tabController = TabController(length: tabItem.length, vsync: this);

  }

  getData() async {
    state.shopCategoryList = await ShopRequest.getShopCategory();
  }

  void toShopCategory(i) {
    Get.toNamed(RouterName.shopCategoryList,arguments: {
      "id":state.shopCategoryList[i].id,
      "name":state.shopCategoryList[i].name
    });
  }
}
